package com.issue.system.service.impl;

import java.util.List;
import com.issue.common.utils.DateUtils;
import com.issue.common.utils.SecurityUtils;
import com.issue.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.issue.system.mapper.ChildCourseMapper;
import com.issue.system.domain.ChildCourse;
import com.issue.system.service.IChildCourseService;

/**
 * CourseService业务层处理
 * 
 * @author system
 * @date 2024-10-20
 */
@Service
public class ChildCourseServiceImpl implements IChildCourseService 
{
    @Autowired
    private ChildCourseMapper childCourseMapper;

    /**
     * 查询Course
     * 
     * @param courseId Course主键
     * @return Course
     */
    @Override
    public ChildCourse selectChildCourseByCourseId(Long courseId)
    {
        return childCourseMapper.selectChildCourseByCourseId(courseId);
    }

    /**
     * 查询Course列表
     * 
     * @param childCourse Course
     * @return Course
     */
    @Override
    public List<ChildCourse> selectChildCourseList(ChildCourse childCourse)
    {
        return childCourseMapper.selectChildCourseList(childCourse);
    }

    /**
     * 新增Course
     * 
     * @param childCourse Course
     * @return 结果
     */
    @Override
    public int insertChildCourse(ChildCourse childCourse)
    {
        childCourse.setCreateTime(DateUtils.getNowDate());
        if (StringUtils.isNotEmpty(SecurityUtils.getUsername())) {
            childCourse.setCreateBy(SecurityUtils.getUsername());
        }
        return childCourseMapper.insertChildCourse(childCourse);
    }

    /**
     * 修改Course
     * 
     * @param childCourse Course
     * @return 结果
     */
    @Override
    public int updateChildCourse(ChildCourse childCourse)
    {
        childCourse.setUpdateTime(DateUtils.getNowDate());
        childCourse.setUpdateBy(SecurityUtils.getUsername());
        return childCourseMapper.updateChildCourse(childCourse);
    }

    /**
     * 批量删除Course
     * 
     * @param courseIds 需要删除的Course主键
     * @return 结果
     */
    @Override
    public int deleteChildCourseByCourseIds(Long[] courseIds)
    {
        return childCourseMapper.deleteChildCourseByCourseIds(courseIds);
    }

    /**
     * 删除Course信息
     * 
     * @param courseId Course主键
     * @return 结果
     */
    @Override
    public int deleteChildCourseByCourseId(Long courseId)
    {
        return childCourseMapper.deleteChildCourseByCourseId(courseId);
    }
}
